import ArrayList from '@ohos.util.ArrayList'

export class HotCity {
  code: string
  topCityList: ArrayList<TopCity>

  static transition(dto: any): HotCity {
    let hotCity = new HotCity()
    hotCity.code = dto.code
    hotCity.topCityList = new ArrayList()
    for (const index in dto.topCityList) {
      hotCity.topCityList.add(TopCity.transition(dto.topCityList[index]))
    }

    return hotCity
  }
}

export class TopCity {
  // "name": "余杭",
  // "id": "101210106",
  // "adm2": "杭州",
  // "adm1": "浙江省",
  name: string | undefined
  id: string | undefined
  adm2: string | undefined
  adm1: string | undefined

  static transition(dto: any): TopCity {
    let topCity = new TopCity()
    topCity.name = dto.name
    topCity.id = dto.id
    topCity.adm2 = dto.adm2
    topCity.adm1 = dto.adm1

    return topCity
  }
}